package json;

import base.User;
import com.google.gson.Gson;

public class GsonDemo {
    public static void main(String[] args) {
        User user = new User();
        user.setName("abc");
        user.setAge(11);
        Gson gson = new Gson();
        String s = gson.toJson(user);
        System.out.println("s = " + s);
        User user1 = gson.fromJson(s, User.class);
        System.out.println("user1 = " + user1);
    }
}
